﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="fans_follow_json.aspx.cs" Inherits="newBlog.User.fans_follow_json" %>

<%@ Import Namespace="newBlog.CenterInc.model" %>
<%@ Import Namespace="newBlog.CenterInc.Ctrltor" %>
<%@ Import Namespace="System.Web.Script.Serialization" %>

<%    Response.ContentType = "application/json";
    if (Session["user_id"] == null)
    {
        Response.Write("{\"error\":\"您暂未登录\"}");
        return;
    }
    string user_id = Session["user_id"].ToString();
    int mode = (Request.QueryString["mode"] == null || Request.QueryString["mode"].Length == 0) ? 0 : Convert.ToInt32(Request.QueryString["mode"]);
    int page = (Request.Form["page"] == null || Request.Form["page"].Length == 0) ? 0 : Convert.ToInt32(Request.Form["page"]) >0 ? (Convert.ToInt32(Request.Form["page"])-1) : 0;
    int Count=0;
    fans_follow_inc fans_Follow_Inc = new fans_follow_inc();
    List<Follow_fans_Dao> list =null;
    if (mode == 1)
    {
        Count = fans_Follow_Inc.followCount(user_id);
        list = fans_Follow_Inc.fllowMsg(user_id,page*20);

    }//获取关注人数
    if (mode==2) {
        Count = fans_Follow_Inc.FansCount(user_id);
        list = fans_Follow_Inc.fansMsg(user_id,page*20);
    }
    JavaScriptSerializer serializer = new JavaScriptSerializer();
    string json = "{\"code\":0,\"msg\":\"\",\"count\":"+Count+",\"data\":"+serializer.Serialize(list)+"}";
    Response.Write(json);
%>